package com.qf.springbootproject.ResultBean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@ApiModel(value = "统一返回结果")
@AllArgsConstructor
public class JsonResult {
    @ApiModelProperty("源数据")
    private Object data;
    @ApiModelProperty("信息")
    private String msg;
    @ApiModelProperty("状态码")
    private int code;


    public static JsonResult resultOk(Object data){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setData(data);
        jsonResult.setMsg("成功");
        return jsonResult;

    }
}
